package com.springboot.cloud.demos.ribbon.rest;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.demos.entity.form.FollowForm;
import com.springboot.cloud.demos.entity.param.FollowQueryParam;
import com.springboot.cloud.demos.ribbon.service.FollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class FollowController {

    @Autowired
    private FollowService followService;

    @RequestMapping(value = "/follow/getFollow", method = RequestMethod.GET)
    public Result getFollow(@RequestParam("userId") String userId, @RequestParam("followUserId") String followUserId){
        return followService.getFollow(userId,followUserId);
    }

    @PostMapping("/follow")
    public Result add(@RequestBody FollowForm followForm) {
        return followService.save(followForm);
    }

    @PutMapping("/follow")
    public Result update(@RequestBody FollowForm followForm) {
        return followService.update(followForm);
    }


    @RequestMapping(value = "/follow/deleteByMap", method = RequestMethod.DELETE)
    Result deleteByMap(@RequestBody  FollowQueryParam queryParam){
        return followService.deleteByMap(queryParam);
    }
}
